#pragma once

using namespace System;
using namespace System::Collections;

ref class TestResult
{
private:
	Hashtable^ ht;
public:
	TestResult() : ht(gcnew Hashtable())
	{
	}
	property int Score[String^]
	{
		int get(String^ name)
		{
			if(ht->ContainsKey(name))
				return safe_cast<int>(ht[name]);
			else
				return 0;
		}
		void set(String^ name, int score)
		{
			ht[name] = score;
		}
	}
};

void Test2()
{
	TestResult^ tres = gcnew TestResult();
	tres->Score["Nish"] = 975;
	tres->Score["Smitha"] = 955;
	tres->Score["Ivor"] = 850;
	tres->Score["Pat"] = 915;

	System::Console::WriteLine("Name:{0},Score{1}", "Pat", tres->Score["Pat"]);	
}

ref class Window
{
private:
	Hashtable^ wndProperties;
public:
	Window() : wndProperties(gcnew Hashtable())
	{
	}
	property Object^ default[String^]
	{
		void set(String^ wndproperty, Object^ value)
		{
			wndProperties[wndproperty] = value;
		}
		Object^ get(String^ wndproperty)
		{
			return wndProperties[wndproperty];
		}
	}
};

void Test3()
{
	Window^ w = gcnew Window();
	w["Title"] = "MyWindow"; 
	w["DefalutView"] = "View1";

	System::Console::WriteLine(w["Title"]);
}